![]() |
PATH![]() |
The USBGetNextDeviceByClass function returns a class driver reference for the class driver matching the specified device class and optionally the device subclass for that device. This function also works with interface references.
OSStatus USBGetNextDeviceByClass (
USBDeviceRef *deviceRef,
CFragConnectionID *connID,
UInt16 theClass,
UInt16 theSubClass,
UInt16 theProtocol);
The USBGetNextDeviceByClass function returns a pointer to the next usbDeviceRef for a class driver matching the specified deviceClass and (optionally) deviceSubClass and deviceProtocol parameters. Pass kNoDeviceRef for the deviceRef parameter to begin, then pass the returned device reference for subsequent searches.
An OSStatus error of -43 is returned if a device cannot be found with the specified parameters. The device reference, deviceRef , returns unchanged if no subsequent match is made. The typical way to find all similar devices is to keep calling the USBGetNextDeviceByClass function until the status value changes from noErr . At that point, the deviceRef is officially undefined.
The driver descriptor structure must have the same class and subclass codes as the codes for the device that is specified in the function call. This is particularly important for vendor specific devices, since the correct driver for the device would not typically load if the class and subclass codes don't match those for the device.
If you are developing a device and the USBGetNextDeviceByClass function isn't finding the requested device, be sure that the driver descriptor structure for your device driver has the same class and subclass codes as the device.
Constants are defined for the device class, subclass, protocol, vendor, and product identifiers which you can pass as wildcard values in the functions USBGetNextDeviceByClass and USBInstallDeviceNotification Installing The Device Callback Request .
In USB version 1.0.1 (the iMac update 1.0) a bug prevented correct searches if usbClass , usbSubclass , and usbProtocol were equal 0 and kNoDeviceRef is used for the deviceRef . This behavior is not present in version 1.1 and greater of the Mac OS USB software.
Previous | Back Up One Level | Next | Show Frames | Hide Frames